#include "myedit.h"

#include <QDebug>

//MyEdit::MyEdit()
//{

//}

MyEdit::MyEdit(QWidget *parent) : QLineEdit(parent) {}

// 该函数主要用来重写按键点击事件
void MyEdit::keyPressEvent(QKeyEvent * event)
{
    qDebug() << "MyEdit key press event";
    QLineEdit::keyPressEvent(event);
    event->ignore();
}

bool MyEdit::event(QEvent *pevent)
{
    if(pevent->type() == QEvent::KeyPress){
        qDebug() << tr("my edit event") << Qt::endl;
    }

    return QLineEdit::event(pevent);
}
